package com.wu.com.wu.spark.core

import org.apache.spark.{SparkConf, SparkContext}

object SortByOperatory {

  def main(args: Array[String]): Unit = {

    val conf = new SparkConf().setAppName("SortByOperatory").setMaster("local")
    val sc = new SparkContext(conf)

    val rdd1  = sc.makeRDD(Seq(1,5,2,6,8,3,9,7))
    val rdd2 = rdd1.sortBy(x =>x ).collect() // 默认是升序
    rdd2.foreach(x =>  println(x))
    println("-------------------------降序-------------------------")
    val rdddesc = rdd1.sortBy(x => x ,false).collect()
    rdddesc.foreach(x => println(x))



  }




}
